if ((getAt(stamp, i) = 3) or (getAt(stamp, i) = 10)) and (getOne(stamp, 10) > 0) then
set previousPeak to P
set PeakDayNo to 0
setAt(stamp, P, 3)
end if
end repeat
end if
killcorrection()
writecycleinfo()
puppetVisible(13, 48, 1)
puppetStatus(11, 48, 0)
if wantsToViewCycles = 0 then
if currentCycleNo <> getAt(cycleNo, userNo) then
set currentCycleNo to getAt(cycleNo, userNo)
readCycleInfo()
end if
go("removeimage")
prepfrontpage()
else
go("removeimage")
go("cycle list")
cursor(0)
end if
end
on upToNow10 dayNum
repeat with i = 1 to dayNum
if getAt(stamp, i) = 10 then
return 1
end if
end repeat
return 0
end
on resetpeak
global PeakDayNo, stamp, previousPeak
if getOne(stamp, 10) > 0 then
setAt(stamp, getOne(stamp, 10), 3)
end if
set previousPeak to PeakDayNo
set PeakDayNo to 0
end
on resetAdvice
global advice, basis, dayNo, stamp, PeakDayNo, previousPeak, forewarned
set advice to []
set basis to []
set PeakDayNo to 0
set forewarned to 0
repeat with i = 1 to count(stamp)
set dayNo to i
if max(bioInfo) = 14 then
getConceiveAdvice()
next repeat
end if
getAbstainAdvice()
end repeat
end
on getOnlyRedPrevious
global stamp, dayNo
if dayNo < 1 then
return 1
end if
if getAt(stamp, 1) > 1 then
return 0
end if
repeat with i = 1 to dayNo - 1
if getAt(stamp, i) > 2 then
return 0
end if
end repeat
set countbrown to 0
repeat with i = 1 to dayNo - 1
if getAt(stamp, i) = 2 then
set countbrown to countbrown + 1
if countbrown > 1 then
return 0
end if
next repeat
end if
set countbrown to 0
end repeat
return 1
end
on getOnlyRedPrevious2 dayNum
if dayNum < 1 then
return 1
end if
repeat with i = 1 to dayNum
if getAt(stamp, i) > 2 then
return 0
end if
end repeat
set countbrown to 0
repeat with i = 1 to dayNum
if getAt(stamp, i) = 2 then
set countbrown to countbrown + 1
if countbrown > 2 then
return 0
end if
next repeat
end if
set countbrown to 0
end repeat
return 1
end
on getAnovulatory
global stamp, previousPeak
if (getOne(stamp, 10) > 0) or (previousPeak > 0) then
killAnovul()
return 0
else
set x to getOne(stamp, 3)
if x > 0 then
set countFromWhite to x
else
set countFromWhite to 1
end if
repeat with i = countFromWhite to count(stamp)
if getAt(stamp, i) = 6 then
setAnovul()
return 1
end if
end repeat
end if
if getOne(bioInfo, 13) > 0 then
return 1
else
return 0
end if
end
on killAnovul
global bioInfo
if getOne(bioInfo, 13) > 0 then
deleteAt(bioInfo, getOne(bioInfo, 13))
end if
end
on setAnovul
global bioInfo
if getOne(bioInfo, 13) = 0 then
append(bioInfo, 13)
end if
if getOne(bioInfo, 9) > 0 then
deleteAt(bioInfo, getOne(bioInfo, 9))
end if
if getOne(bioInfo, 10) > 0 then
deleteAt(bioInfo, getOne(bioInfo, 10))
end if
if getOne(bioInfo, 11) > 0 then
deleteAt(bioInfo, getOne(bioInfo, 11))
end if
end
on start3YellowBabies
global PeakDayNo, previousPeak
set dayNum to count(stamp)
if (getAt(stamp, 1) = 4) and (PeakDayNo = 0) and (previousPeak = 0) then
return 1
end if
return 0
end
on inspectbasis basisNo
if getOne(goodbasisList, basisNo) then
return 1
else
return 0
end if
end
on violatedRule
global relations, advice, dayNo
set dayNum to dayNo
if dayNum < 2 then
return 0
end if
if getAt(relations, dayNum - 1) <> 4 then
set lookadvice to getAt(advice, dayNum - 1)
if lookadvice > 1000 then
set lookadvice to lookadvice - 1000
end if
if (lookadvice = 101) or (lookadvice = 104) or ((lookadvice > 106) and (lookadvice < 110)) then
return 1
else
if (lookadvice = 102) and (getAt(relations, dayNum - 1) <> 2) then
return 1
else
return 0
end if
end if
else
return 0
end if
end
on alertviolatedRule
global relations, advice, dayNo
set dayNum to dayNo
if dayNum < 1 then
return 0
end if
if getAt(relations, dayNum) <> 4 then
set lookadvice to getAt(advice, dayNum)
if lookadvice > 1000 then
set lookadvice to lookadvice - 1000
end if
if (lookadvice = 101) or (lookadvice = 104) or ((lookadvice > 106) and (lookadvice < 110)) then
return 1
else
if (lookadvice = 102) and (getAt(relations, dayNum) <> 2) then
return 1
else
return 0
end if
end if
else
return 0
end if
end
on anyFertileDay
global mucus
set last to count(mucus)
repeat with i = 1 to last
if (getAt(mucus, i) < 7) and (getAt(mucus, i) > 1) then
return 1
end if
end repeat
end
on checkLogicRed
global stamp, mucus
if getOnlyRedPrevious() = 0 then
cursor(0)
go("StartNewCycle")
cursor(0)
else
append(relations, 0)
append(stamp, 1)
append(mucus, 0)
showDays()
setupDayBook()
cursor(0)
end if
end
on checkLogicBrown
global stamp, mucus, PeakDayNo
set dayNum to count(stamp)
if dayNum > 0 then
if ((PeakDayNo > 0) and ((dayNum - PeakDayNo) < 3)) or (getAt(stamp, dayNum) = 3) then
cursor(0)
set the visible of sprite 16 to 0
alert("If dry within three days after the presence of mucus or spotting, choose the Brown Baby Stamp.")
set the visible of sprite 16 to 1
else
append(relations, 0)
append(mucus, 0)
append(stamp, 2)
setupDayBook()
showDays()
cursor(0)
end if
else
append(relations, 0)
append(mucus, 0)
append(stamp, 2)
setupDayBook()
showDays()
cursor(0)
end if
end
on checkLogicWhite
global PeakDayNo, stamp, forewarned, candidateStamp
if forewarned = 1 then
cursor(0)
alert("The Previous Peak will be removed.")
cursor(4)
set forewarned to 0
resetpeak()
set candidateStamp to 3
go("chart mucus")
cursor(0)
else
if getOne(stamp, 10) > 0 then
cursor(0)
if max(mucus) > 0 then
set forewarned to 1
set the visible of sprite 16 to 0
alert(" You have chosen the White Baby stamp but Peak Day was identified previously." & RETURN & " If you have a milky white mucus, choose the Yellow Stamp. If you have a moist or lubricated sensation or a clear, stretchy mucus, choose the White Baby stamp again.")
set the visible of sprite 16 to 1
else
set candidateStamp to 3
go("chart mucus")
cursor(0)
set PeakDayNo to 0
end if
else
if PeakDayNo > 0 then
set PeakDayNo to 0
end if
set candidateStamp to 3
go("chart mucus")
cursor(0)
end if
end if
end
on checklogicYellowBaby
global PeakDayNo, stamp, candidateStamp, mucus
set dayNum to count(stamp)
if dayNum > 0 then
if ((PeakDayNo > 0) and ((count(stamp) - PeakDayNo) > 2)) or ((PeakDayNo > 0) and ((count(stamp) - PeakDayNo) < 4) and ((PeakDayNo - getOne(stamp, 10)) > 3) and (getAt(stamp, count(stamp)) <> 3)) or ThreeBabies() then
cursor(0)
set the visible of sprite 16 to 0
alert("The Yellow Baby stamp should only be chosen for the three days after Peak Day. ")
set the visible of sprite 16 to 1
else
if (getAt(mucus, dayNum) < 7) and (getAt(mucus, dayNum) > 1) then
set candidateStamp to 4
go("askSensation")
cursor(0)
else
if (getAt(stamp, count(stamp)) = 2) or (getAt(stamp, count(stamp)) = 6) or getOnlyRedPrevious() or (not SomethingFertile() and (dayNum > 3)) then
cursor(0)
set the visible of sprite 16 to 0
alert("The Yellow Baby stamp should only be chosen for the three days after Peak Day. At the onset of mucus, choose the White Baby Stamp.")
set the visible of sprite 16 to 1
else
set candidateStamp to 4
go("chart mucus")
cursor(0)
end if
end if
end if
else
set candidateStamp to 4
go("chart mucus")
cursor(0)
end if
end
on ThreeBabies
set x to 0
set dayNum to count(stamp)
if dayNum < 3 then
return 0
end if
repeat with i = 0 to 2
if (getAt(stamp, dayNum - i) = 4) or (getAt(stamp, dayNum - i) = 5) or (getAt(stamp, dayNum - i) = 0) then
set x to x + 1
next repeat
end if
set x to 0
end repeat
if x > 2 then
return 1
else
return 0
end if
end
on SomethingFertile
repeat with dayNum = 1 to count(stamp)
if (getAt(mucus, dayNum) < 7) and (getAt(mucus, dayNum) > 1) then
return 1
end if
end repeat
return 0
end
on checkLogicBrownBaby
global PeakDayNo, stamp, candidateStamp, mucus
set dayNum to count(stamp)
if dayNum > 0 then
if ((PeakDayNo > 0) and ((count(stamp) - PeakDayNo) > 2)) or ThreeBabies() then
cursor(0)
set the visible of sprite 16 to 0
alert("The brown baby stamp should only be chosen for the three days after the presence of mucus or spotting. When dry at other times use the brown stamp.")
set the visible of sprite 16 to 1
else
if (getAt(mucus, dayNum) < 7) and (getAt(mucus, dayNum) > 1) then
set candidateStamp to 5
go("askSensation")
cursor(0)
else
if (getAt(stamp, count(stamp)) = 2) or (getAt(stamp, count(stamp)) = 6) or ((getAt(stamp, count(stamp)) = 1) and getOnlyRedPrevious() and not getAnovulatory()) then
cursor(0)
set the visible of sprite 16 to 0
alert("The brown baby stamp should only be chosen for the three days after the presence of mucus or spotting. When dry at other times use the brown stamp.")
set the visible of sprite 16 to 1
else
append(relations, 0)
append(mucus, 0)
append(stamp, 5)
showDays()
setupDayBook()
end if
end if
cursor(0)
end if
else
append(relations, 0)
append(mucus, 0)
append(stamp, 5)
showDays()
setupDayBook()
end if
end
on checkLogicYellow
global stamp, mucus, PeakDayNo, candidateStamp, warnYellow
if count(stamp) = 0 then
if warnYellow = 1 then
set warnYellow to 0
set candidateStamp to 6
go("chart mucus")
cursor(0)
exit
else
set warnYellow to 1
cursor(0)
set the visible of sprite 16 to 0
alert("You may select the Yellow Stamp only if you've had two weeks of unchanging mucus. " & RETURN & RETURN & "If you've had two weeks of unchanging mucus, select the Yellow Stamp again.")
set the visible of sprite 16 to 1
exit
end if
end if
if getOne(stamp, 10) > 0 then
if (count(stamp) - PeakDayNo) < 3 then
cursor(0)
set the visible of sprite 16 to 0
alert("For the three days after Peak Day or Spotting, choose a Baby Stamp.")
set the visible of sprite 16 to 1
else
set candidateStamp to 6
go("chart mucus")
cursor(0)
end if
else
if ((PeakDayNo > 0) and ((count(stamp) - PeakDayNo) < 3)) or (getAt(stamp, count(stamp)) = 3) then
cursor(0)
set the visible of sprite 16 to 0
alert("For the three days after Peak type mucus or spotting, choose a Baby Stamp.")
set the visible of sprite 16 to 1
else
if getAnovulatory() or warnYellow then
set warnYellow to 0
set candidateStamp to 6
go("chart mucus")
cursor(0)
else
set warnYellow to 1
cursor(0)
set the visible of sprite 16 to 0
alert("You may select the Yellow Stamp only if you've had two weeks of unchanging mucus. " & RETURN & RETURN & "If you've had two weeks of unchanging mucus, select the Yellow Stamp again.")
set the visible of sprite 16 to 1
end if
end if
end if
end
on checkLogic2
global PeakDayNo
if getOne(stamp, 1) > 0 then
set first to getOne(stamp, 1)
repeat with i = first to count(stamp) - 1
if (getAt(stamp, i) = 1) and (i > 2) then
if (getAt(stamp, i - 1) <> 1) and (getAt(stamp, i - 2) <> 1) then
if getAt(stamp, i + 1) = 2 then
put "ERROR: " & "On Day# " & i + 1 & ", the Brown Stamp was used. If dry within three days after spotting, use the Brown Baby Stamp." into field "problem"
return 0
next repeat
end if
if getAt(stamp, i + 1) = 6 then
put "ERROR: " & "On Day# " & i + 1 & ", the Yellow Stamp was used. If dry within three days after spotting, use the Brown Baby Stamp." into field "problem"
return 0
end if
end if
end if
end repeat
end if
if (getOne(stamp, 3) > 0) or (getOne(stamp, 10) > 0) then
repeat with i = 1 to count(stamp) - 1
if (getAt(mucus, i) < 7) and (getAt(mucus, i) > 1) and ((getAt(mucus, i + 1) > 7) or (getAt(mucus, i + 1) = 1)) and (getAt(stamp, i + 1) <> 4) then
put "ERROR: " & "On Day# " & i + 1 & ", there was a dramatic change in mucus. The Yellow Baby Stamp should have been used unless there was a wet or lubricated sensation. If there was a wet or lubricated sensation, use the White Baby Stamp and the Sensation (raindrop) stamp." into field "problem"
return 0
end if
if (getAt(stamp, i) = 3) or (getAt(stamp, i) = 10) then
if getAt(stamp, i + 1) = 2 then
put "ERROR: " & "On Day# " & i + 1 & ", the Brown Stamp was used. If dry within three days after the presence of mucus or spotting, use the Brown Baby Stamp." into field "problem"
return 0
next repeat
end if
if (getAt(stamp, i + 1) = 6) and (getAt(mucus, i) < 7) and (getAt(mucus, i) > 1) then
put "ERROR: " & "On Day# " & i + 1 & ", the Yellow Stamp was used. Three days after the appearance of Peak Type mucus, use the Yellow Baby Stamp." into field "problem"
return 0
next repeat
end if
if (i + 2) < count(stamp) then
if getAt(stamp, i + 2) = 2 then
put "ERROR: " & "On Day# " & i + 2 & ", the Brown Stamp was used. If dry within three days after the presence of mucus or spotting, use the Brown Baby Stamp." into field "problem"
return 0
next repeat
end if
if (getAt(stamp, i + 2) = 6) and (getAt(mucus, i) < 7) and (getAt(mucus, i) > 1) then
put "ERROR: " & "On Day# " & i + 1 & ", the Yellow Stamp was used. Three days after the appearance of Peak Type mucus, use the Yellow Baby Stamp." into field "problem"
return 0
next repeat
end if
if (i + 3) < count(stamp) then
if getAt(stamp, i + 3) = 2 then
put "ERROR: " & "On Day# " & i + 3 & ", the Brown Stamp was used. If dry within three days after the presence of mucus or spotting, use the Brown Baby Stamp." into field "problem"
return 0
next repeat
end if
if (getAt(stamp, i + 3) = 6) and (getAt(mucus, i) < 7) and (getAt(mucus, i) > 1) then
put "ERROR: " & "On Day# " & i + 1 & ", the Yellow Stamp was used. Three days after the appearance of Peak Type mucus, use the Yellow Baby Stamp." into field "problem"
return 0
end if
end if
end if
end if
end repeat
end if
if (getOne(stamp, 4) > 0) or (getOne(stamp, 5) > 0) then
set x to 0
repeat with i = 1 to count(stamp)
if (getAt(stamp, i) = 4) or (getAt(stamp, i) = 5) then
if i > 1 then
if (getAt(stamp, i - 1) = 2) or (getAt(stamp, i - 1) = 6) then
if getAt(stamp, i) = 5 then
put "ERROR: " & "On Day# " & i & ", the Brown Baby Stamp was used. Only use the Brown Baby Stamp the three days after the presence of mucus or spotting, at all other dry times use the Brown Stamp." into field "problem"
return 0
else
put "ERROR: " & "On Day# " & i & ", the Yellow Baby Stamp was used. Only use the Yellow Baby Stamp the three days after Peak day or spotting." into field "problem"
return 0
end if
end if
end if
set x to x + 1
if x >= 4 then
if getAt(stamp, i) = 5 then
put "ERROR: " & "On Day# " & i & ", the Brown Baby Stamp was used. If dry after Peak+3 days or more than three days after mucus or spotting, use the Brown Stamp." into field "problem"
return 0
else
put "ERROR: " & "On Day# " & i & ", the Yellow Baby Stamp was used. If mucus is present after Peak+3 days or more than three days after spotting, use the Yellow Stamp or White Stamp." into field "problem"
end if
return 0
end if
next repeat
end if
set x to 0
end repeat
if not anyFertileDay() and (getOne(stamp, 4) > 0) then
put "ERROR: The Yellow Baby Stamp was used but there was no previous Peak type day." into field "problem"